package com.sgsg.delegatemode;

import java.util.ArrayList;

public class SubjectB implements Subject{
    private String subjectState;
    private ArrayList<Observer> observers = new ArrayList<>();

    public String getSubjectState() {
        return subjectState;
    }

    public void setSubjectState(String subjectState) {
        this.subjectState = subjectState;
    }

    @Override
    public void addObserver(Observer observer) {
        observers.add(observer);
    }

    @Override
    public void detachObserver(Observer observer) {
        observers.remove(observer);
    }

    @Override
    public void Notify() {
        for(Observer obs : observers){
            obs.update();
        }
    }
}
